package com.tudouji.project.mt.http.request;

import com.google.gson.reflect.TypeToken;
import com.meituan.sdk.MeituanRequest;
import com.meituan.sdk.MeituanResponse;
import com.meituan.sdk.annotations.ApiMeta;
import com.meituan.sdk.internal.utils.JsonUtil;
import com.tudouji.project.mt.http.response.PoiStockInItemResponse;
import com.tudouji.project.mt.http.response.PoiStockOutItemResponse;
import lombok.Data;

import java.lang.reflect.Type;

/**
 * 门店_分页查询出库单主单
 */
@ApiMeta(
        path = "/rms/scmplus/inventory/api/v1/poi/stockOutItem/query",
        businessId = 18,
        apiVersion = "",
        apiName = "",
        needAuth = true
)
@Data
public class PoiStockOutItemRequest implements MeituanRequest<PoiStockOutItemResponse> {

    //所属配送中心ID
    private Long orgId;

    //入库时间-开始(毫秒时间戳)
    private Long bizTimeBegin;

    //入库时间-结束(毫秒时间戳)
    private Long bizTimeEnd;

    private Integer status;

    private Page page;

    @Data
    public static class Page{
        //页码,从1开始
        private Integer pageNo;

        //页大小,1~200
        private Integer pageSize;

        public Page(Integer pageNo, Integer pageSize) {
            this.pageNo = pageNo;
            this.pageSize = pageSize;
        }
    }

    @Override
    public MeituanResponse<PoiStockOutItemResponse> deserializeResponse(String response) {
        Type type = new TypeToken<MeituanResponse<PoiStockOutItemResponse>>(){}.getType();
        return JsonUtil.fromJson(response, type);
    }
    @Override
    public String serializeToJson() {
        return JsonUtil.toJson(this);
    }
}
